﻿#ifndef ROUTEIMPORT_H
#define ROUTEIMPORT_H

#include <QWidget>
#include <QGeoCoordinate>
#include <QList>

#include "route.h"

namespace Ui {
    class RouteImport;
}

class RouteImport : public QWidget
{
    Q_OBJECT

private:
    explicit RouteImport();

public:
    ~RouteImport();

    static Route showPopup();

signals:
    void finished();
    void routeLoaded(const Route &r);

private:
    bool eventFilter(QObject *watched, QEvent *event) override;
    void init();
    void initControls();
    void initConnection();
    QList<QGeoCoordinate> convertFile(const QString &fileName);
    QList<QGeoCoordinate> convertNrFile(const QString &fileName);
    QList<QGeoCoordinate> convertRtzFile(const QString &fileName);
    QList<QGeoCoordinate> convertWptFile(const QString &fileName);

private slots:
    void import();
    void browse();

private:
    Ui::RouteImport *ui;
};

#endif // ROUTEIMPORT_H
